{% spaceless %}
{% autoescape off %}
{% load ietf_filters %}
{% load textfilters %}

{% if doc.type_id == "rfc" %}
{% if doc.stream|slugify == "legacy" %}
% Datatracker information for RFCs on the Legacy Stream is unfortunately often
% incorrect. Please correct the bibtex below based on the information in the
% actual RFC at https://rfc-editor.org/rfc/rfc{{ doc.rfc_number }}.txt
{% endif %}
@misc{% templatetag openbrace %}rfc{{ doc.rfc_number }},
    series =    {Request for Comments},
    number =    {{ doc.rfc_number }},
    howpublished =  {% templatetag openbrace %}RFC {{ doc.rfc_number }}{% if doc.doc.intended_std_level %} ({{ doc.intended_std_level }}){% endif %}{% templatetag closebrace %},
    publisher = {RFC Editor},
    doi =       {% templatetag openbrace %}{{ doi }}{% templatetag closebrace %},
    url =       {% templatetag openbrace %}{{ doc.rfc_number|rfceditor_info_url }}{% templatetag closebrace %},{% else %}
{% if published_as %}%% You should probably cite rfc{{ published_as.rfc_number }} instead of this I-D.{% else %}{% if replaced_by %}%% You should probably cite {{replaced_by|join:" or "}} instead of this I-D.{% else %}
{% if doc.rev != latest_revision.rev %}%% You should probably cite {{latest_revision.doc.name}}-{{latest_revision.rev}} instead of this revision.{%endif%}{% endif %}{% endif %}
@techreport{% templatetag openbrace %}{{doc.name|slice:"6:"}}-{{doc.rev}},
    number =    {% templatetag openbrace %}{{doc.name}}-{{doc.rev}}{% templatetag closebrace %},
    type =      {% templatetag openbrace %}Internet-Draft{% templatetag closebrace %},
    institution =   {% templatetag openbrace %}Internet Engineering Task Force{% templatetag closebrace %},
    publisher = {% templatetag openbrace %}Internet Engineering Task Force{% templatetag closebrace %},
    note =      {% templatetag openbrace %}Work in Progress{% templatetag closebrace %},
    url =       {% templatetag openbrace %}{{ settings.IDTRACKER_BASE_URL }}{% url 'ietf.doc.views_doc.document_main' name=doc.name rev=doc.rev %}{% templatetag closebrace %},{% endif %}
    author =    {% templatetag openbrace %}{% for author in doc.documentauthor_set.all %}{{ author.person.name|texescape}}{% if not forloop.last %} and {% endif %}{% endfor %}{% templatetag closebrace %},
    title =     {% templatetag openbrace %}{% templatetag openbrace %}{{doc.title|texescape}}{% templatetag closebrace %}{% templatetag closebrace %},
    pagetotal = {{ doc.pages }},
    year =      {{ doc.pub_date.year }},
    month =     {{ doc.pub_date|date:"b" }},{% if not doc.type_id == "rfc" or doc.pub_date.day == 1 and doc.pub_date.month == 4  %}
    day =       {{ doc.pub_date.day }},{% endif %}
    abstract =  {% templatetag openbrace %}{{ doc.abstract|clean_whitespace|texescape }}{% templatetag closebrace %},
{% templatetag closebrace %}

{% endautoescape %}
{% endspaceless %}
